/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pa165.pneu.pneuservisbackend.services;

import java.util.List;
import pa165.pneu.pneuservisbackend.to.CustomerTO;
import pa165.pneu.pneuservisbackend.to.OrderPneuTO;

/**
 *
 * @author Martin Tarasovic
 */
public interface OrderPneuService {
    /**
     * Stores new Order into database. Id for the new Order is automatically
     * generated and stored into id attribute. Order can not have assigned id
     * and can not have Customer null.
     *
     * @param OrderPneu order to be created.
     * @throws IllegalArgumentException when order is null, or order has already
     * assigned id.
     */
    void createOrder(OrderPneuTO orderPneu);

    /**
     * Returns order with given id.
     *
     * @param id primary key of requested order.
     * @return order with given id or null if such order does not exist.
     * @throws IllegalArgumentException when given id is null.
     */
    OrderPneuTO getOrder(Long id);

    /**
     * Updates order in database.
     *
     * @param orderPneu updated order to be stored into database.
     * @throws IllegalArgumentException when order is null, or order has null
     * id.
     */
    void updateOrder(OrderPneuTO orderPneu);

    /**
     * Deletes order from database. When order is not in db, loggs info, but
     * does not throw an exception.
     *
     * @param orderPneu order to be deleted from db.
     * @throws IllegalArgumentException when order is null or has a null id.
     */
    void removeOrder(OrderPneuTO orderPneu);

    /**
     * Returns list of all orders in the database in order of their appearance,
     * older first.
     *
     * @return list of all orders in database.
     */
    List<OrderPneuTO> getAllOrders();

    /**
     * Returns list of all orders with certain customer in the database, in
     * order of their appearance, older first.
     *
     * @param customer
     * @return list of all orders with certain customer in database.
     */
    List<OrderPneuTO> getOrdersByCustomer(CustomerTO customer);
}
